package test00.lx07;

import java.util.stream.Stream;

/**
 * @author CSY
 * @date 2025 - 04 - 08
 */
public class MainTest01 {
    public static void main(String[] args) {
        Student[] stus = {
                new Student("张三",18),
                new Student("李四",16),
                new Student("李白",21),
                new Student("赵六",20),
                new Student("李蛋",19),
                new Student("李清照",25),
                new Student("李世明",20)
        };

//        Stream<Student> stream = Arrays.stream(stus);
        Stream<Student> stream = Stream.of(stus);
        //    boolean test(T t);
        stream.filter((t) ->  t.getName().charAt(0) == '李' && t.getAge() > 18)
//                .filter(t -> t.getAge() > 18)
                .sorted((o1,o2) -> o2.getAge() - o1.getAge())
                .map(Student::getName)
                .limit(2)
                .forEach(System.out::println);
    }
}
